package com.lanou.mynews.issue;


import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.lanou.mynews.R;


import java.util.List;

/**
 * Created by dllo on 16/2/24.
 */
public class IssueContentAdapter extends BaseAdapter {
    private List<IssueContentEty.DataEntity.HotListEntity> datas;
    private Context mContext;

    public IssueContentAdapter(Context context, List<IssueContentEty.DataEntity.HotListEntity> datas) {
        this.mContext = context;
        this.datas = datas;
    }

    @Override
    public int getCount() {
        if (datas != null && datas.size() > 0)
            return datas.size();
        else
            return 0;
    }

    @Override
    public Object getItem(int position) {
        if (datas != null && datas.size() > 0)
            return datas.get(position);
        else
            return null;
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup viewGroup) {

        ViewHolder holder = null;


        if (convertView == null) {
            convertView = LayoutInflater.from(mContext).inflate(
                    R.layout.issue_content_list, null);
            holder = new ViewHolder();


            holder.textView_description = (TextView) convertView.findViewById(R.id.neirongt);
            holder.imageView = (ImageView) convertView.findViewById(R.id.imageViewttt);

//            holder.one = (TextView) convertView.findViewById(R.id.issue_one);
//            holder.two = (TextView) convertView.findViewById(R.id.tv_4);


            convertView.setTag(holder);

        } else {
            holder = (ViewHolder) convertView.getTag();


        }
        IssueContentEty.DataEntity.HotListEntity issueety = (IssueContentEty.DataEntity.HotListEntity) getItem(position);
        if (issueety != null) {

            holder.textView_description.setText(issueety.getAnswer().getContent());
//            Picasso.with(mContext).load(issueety.getPicurl()).into(holder.imageView);

//            holder.one.setText(issueety.getConcernCount() + "");
//            holder.two.setText(issueety.getClassification());


        }


        return convertView;
    }

    private class ViewHolder {
        public ImageView imageView;
        public TextView one, two;
        public TextView textView_description;


    }


}
